From 4e1324a1f92301d24c6fbbdac4e5eec2e019974f Mon Sep 17 00:00:00 2001 From: Robert Lipe Date: Mon, 3 Dec 2018 00:37:29 -0600 Subject: [PATCH] Warning fixes in jeeps: move use closer to initialization so that the test of device is effective, don't set locals before return. --- jeeps/gpsserial.cc | 2 -- mac/libusb/darwin.c | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/jeeps/gpsserial.cc b/jeeps/gpsserial.cc index 26343a89b..147f4c8b4 100644 --- a/jeeps/gpsserial.cc +++ b/jeeps/gpsserial.cc @@ -610,8 +610,6 @@ int32 GPS_Serial_Off(gpsdevh* dh) gps_errno = HARDWARE_ERROR; return 0; } - dh = nullptr; - return 1; } diff --git a/mac/libusb/darwin.c b/mac/libusb/darwin.c index 749e09ecc..d52b6b757 100644 --- a/mac/libusb/darwin.c +++ b/mac/libusb/darwin.c @@ -283,9 +283,6 @@ int usb_os_open(usb_dev_handle *dev) usb_device_t **darwin_device; - UInt32 location = *((UInt32 *)dev->device->dev); - UInt32 dlocation; - if (!dev) USB_ERROR(-ENXIO); @@ -304,6 +301,10 @@ int usb_os_open(usb_dev_handle *dev) if ((result = usb_setup_iterator (&deviceIterator)) < 0) return result; + UInt32 location = *((UInt32 *)dev->device->dev); + UInt32 dlocation; + + /* This port of libusb uses locations to keep track of devices. */ while ((darwin_device = usb_get_next_device (deviceIterator, &dlocation)) != NULL) { if (dlocation == location) -- 2.30.2